const fs = require("fs");
const cp = require('child_process')

window.customApis = {
  readFile: (path) => {
    return fs.readFileSync(path, "utf8");
  },

  runshell: (shell) => {
  	console.log("runshell")
  	console.log(shell)
  	// 执行命令
	cp.exec(shell, (error, stdout, stderr) => {
	  if (error) {
	    console.error(`执行命令时出错: ${error}`);
	    return;
	  }
	  console.log(`stdout: ${stdout}`);
	  console.error(`stderr: ${stderr}`);
	});
  }
};
